<?php
error_reporting(7);

$templatelist = "print,print_content,print_editor";
$noheader = 1;
require "global.php";

$articleid = intval($_GET[articleid]);
if (empty($articleid)) {
        $nav = $_SERVER["REQUEST_URI"];
        $script = $_SERVER["SCRIPT_NAME"];
        $nav = ereg_replace("^$script", "", urldecode($nav));
        $vars = explode("/", $nav);
        $articleid = intval($vars[1]);
} 

$article = validate_articleid($articleid);

if (!$pauserinfo[isadmin] AND !$pauserinfo[canviewarticle]) {
        show_nopermission();
} 

$article[date] = padate($dateformat_article, $article[date]);

$contents = $DB->query("SELECT subhead,articletext
                               FROM " . $db_prefix . "articletext
                               WHERE articleid='" . addslashes($articleid) . "' ORDER BY displayorder,id");
$printbit = '';
while ($articletext = $DB->fetch_array($contents)) {
        eval("\$printbit .= \"" . gettemplate('print_content') . "\";");
} 

if (pa_isset($article[editor])) {
        eval("\$editor = \"" . gettemplate('print_editor') . "\";");
} 
eval("dooutput(\"" . gettemplate('print') . "\");");
?>